// ml:run = $bin < input
// ml:opt = 0
// ml:ccf += -g
#include <iostream>
#include <utility>
#include <queue>
#include <functional>
#include <algorithm>
#include <vector>

int const maxn = 1000007;
int father[maxn];
bool self[maxn];
int count[maxn];
int size[maxn];
bool vis[maxn];
int degree[maxn];
int n, m;
std::vector<std::vector<int>> g;

void init()
{
    g.resize(n + 1);
    for (int i = 1; i <= n; i++) father[i] = i;
}

void add_edge(int u, int v)
{
    if (u == v) self[u] = true;
    g[u].push_back(v);
    g[v].push_back(u);
    degree[u]++;
    degree[v]++;
}

int get_father(int x)
{
    return x == father[x] ? x : father[x] = get_father(father[x]);
}

void set_union(int u, int v)
{
    int tu = get_father(u);
    int tv = get_father(v);
    if (tu != tv) father[tu] =tv;
}

void print(std::vector<int> const& v)
{
    std::cout << v.size() << " :";
    for (auto i : v) std::cout << " " << i;
    std::cout << "\n";
}

int main()
{
    std::ios_base::sync_with_stdio(false);
    std::cin >> n >> m;
    init();
    for (int i = 0; i < m; i++) {
        int u, v; std::cin >> u >> v;
        add_edge(u, v);
        set_union(u, v);
    }
    for (int i = 1; i <= n; i++) father[i] = get_father(father[i]);
    for (int i = 1; i <= n; i++) {
        if (degree[i] & 1) count[father[i]]++;
        size[father[i]]++;
    }

    std::priority_queue<std::pair<int, int>> pq;
    std::vector<int> v;

    int zero = 0, tot = 0;
    for (int i = 1; i <= n; i++) {
        int id = father[i];
        v.push_back(id);
        if (vis[id]) continue;
        if (count[id]) pq.push({count[id], v.size()});
        else if (i == 1 || size[id] > 1 || self[i]) zero++;
        tot += count[id];
        vis[id] = true;
    }
    int len = v.size();
    for (int i = 1; i <= len; i++) father[i] = i;
    int ans = 0;
    while (pq.size() > 1) {
        auto t1 = pq.top(); pq.pop();
        auto t2 = pq.top(); pq.pop();
        set_union(t1.second, t2.second);
        int t3 = t1.first + t2.first - 2;
        ans++;
        if (t3) {
            pq.push({t3, get_father(t1.first)});
        } else zero++;
    }

    if (pq.empty()) {
        ans += std::min(2 * (zero - 1), zero);
    } else {
        int t = pq.top().first;
        ans += zero + 1;
        t -= 2;
        ans += t / 2;
    }
    std::cout << ans << "\n";
}

